package cn.jbolt.ai.core.chain.node.action.rewrite;


import cn.jbolt.util.JSONUtil;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;

public class RewriteNodeConfig  {



    /**
     * 结果输出字段
     */
    private String outputField;

    /**
     * 输入字段
     */
    private String inputField=null;
    /**
     * 每次查询要的结果 条数
     */
    private int limit = 6;
    /**
     * 是否输出到响应
     */
    private boolean outputToResponse = false;


    public static RewriteNodeConfig from(JsonNode jsonNode) {
        RewriteNodeConfig config = JSONUtil.toObject(jsonNode, RewriteNodeConfig.class);


        return config;
    }

    //  转换为 JSON 字符串的方法
    public static ObjectNode getDefaultConfig() {
        RewriteNodeConfig config = new RewriteNodeConfig();
        return JSONUtil.toJsonObject(config);
    }

    public boolean isOutputToResponse() {
        return outputToResponse;
    }

    public void setOutputToResponse(boolean outputToResponse) {
        this.outputToResponse = outputToResponse;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }

    public String getInputField() {
        return inputField;
    }

    public void setInputField(String inputField) {
        this.inputField = inputField;
    }

    public String getOutputField() {
        return outputField;
    }

    public void setOutputField(String outputField) {
        this.outputField = outputField;
    }
}
